﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/WithoutPermBasic.Master" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="PMS.Login" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <meta charset="UTF-8" />
    <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">  -->
    <title>系统登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Login and Registration Form with HTML5 and CSS3" />
    <meta name="keywords" content="html5, css3, form, switch, animation, :target, pseudo-class" />
    <meta name="author" content="Codrops" />
    <link href="Content/login/login.css" type="text/css" rel="stylesheet" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceToorbar" runat="server">
    <div class="login">
        <div class="message">杭州新世纪配气系统</div>
        <div id="darkbannerwrap"></div>
        <form id="upForm">
            <input id="username" placeholder="用户名" type="text" />
            <input id="password" placeholder="密码" type="password" style='margin-top: 20px' />
            <input value="登 录" id="login" style="width: 100%; margin-top: 20px" type="button" />
        </form>
    </div>

    <script type="text/javascript">

        (function () {
            $("#login").on("click", login);
            $(document).keyup(function (event) {
                if (event.keyCode === 13) {
                    login();
                }
            });

            //登陆函数
            function login() {
                var account = $('#username').val(),
                    password = $('#password').val();
                if (account && password) {
                    com.ajax({
                        url: "/Logic/BD/LoginAjax.aspx?method=checkUser",
                        type: "POST",
                        //async:false,
                        data: {
                            "account": account,
                            "password": password
                        },
                        success: function (data) {
                            if ("success" == data.state) {
                                window.location.href = data.msg
                            } else {
                                $.messager.show({
                                    title: 'Error',
                                    msg: data.msg,
                                    showType: 'show'
                                });
                                $('#password').val('');
                            }
                        }
                    });
                } else {
                    $.messager.show({
                        title: 'Error',
                        msg: '用户名和密码不能为空',
                        showType:'show'
                    })
                }
            }
        })()

</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
</asp:Content>
